package com.zhangfb95.crosschain.server.infra.data.api.exc;

import com.zhangfb95.crosschain.infra.model.Result;
import com.zhangfb95.crosschain.protocol.exc.ExcChainService;
import com.zhangfb95.crosschain.protocol.exc.request.GetBlockByNumberExcReq;
import com.zhangfb95.crosschain.protocol.exc.request.GetHeightExcReq;
import com.zhangfb95.crosschain.protocol.exc.request.GetTxByIdExcReq;
import com.zhangfb95.crosschain.protocol.exc.request.QueryExcReq;
import com.zhangfb95.crosschain.protocol.exc.request.SendExcReq;
import com.zhangfb95.crosschain.protocol.exc.response.GetBlockByNumberExcRes;
import com.zhangfb95.crosschain.protocol.exc.response.GetHeightExcRes;
import com.zhangfb95.crosschain.protocol.exc.response.GetTxByIdExcRes;
import com.zhangfb95.crosschain.protocol.exc.response.ListChainPathExcRes;
import com.zhangfb95.crosschain.protocol.exc.response.QueryExcRes;
import com.zhangfb95.crosschain.protocol.exc.response.SendExcRes;
import com.zhangfb95.crosschain.protocol.exc.response.TestExcRes;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
import org.springframework.web.service.annotation.PostExchange;

/**
 * @author zhangfubing
 * @since 2023/10/19
 */
@HttpExchange("/exc/chain")
public interface ExcChainApi extends ExcChainService {

    @GetExchange("/test")
    @Override
    Result<TestExcRes> test();

    @GetExchange("/listChainPath")
    @Override
    Result<ListChainPathExcRes> listChainPath();

    @PostExchange("/getHeight")
    @Override
    Result<GetHeightExcRes> getHeight(@RequestBody @Validated GetHeightExcReq req);

    @PostExchange("/getBlockByNumber")
    @Override
    Result<GetBlockByNumberExcRes> getBlockByNumber(@RequestBody @Validated GetBlockByNumberExcReq req);

    @PostExchange("/getTxById")
    @Override
    Result<GetTxByIdExcRes> getTxById(@RequestBody @Validated GetTxByIdExcReq req);

    @PostExchange("/query")
    @Override
    Result<QueryExcRes> query(@RequestBody @Validated QueryExcReq req);

    @PostExchange("/send")
    @Override
    Result<SendExcRes> send(@RequestBody @Validated SendExcReq req);
}
